import request from '@/utils/request.js'

//提供调用登录接口的函数
export const userLoginService = (loginData)=>{
    return request.post('/login',loginData)
}

//提供调用注册接口的函数
export const userRegisterService = (registerData)=>{
    return request.post('/register',registerData);
}

//获取用户详细信息
export const userInfoService = ()=>{
    return request.get('/userInfo')
}

//修改个人信息
export const userInfoUpdateService = (userInfoData)=>{
   return request.put('/user/update',userInfoData)
}

//修改密码
export const updatePasswordService = (passwordData)=>{
    return request.post('/user/updatePassword',passwordData)
}


// 管理员获取所有用户信息
// !以下为管理员操作
export const userListService = () => {
    return request.get('/users/list')
}

export const userAddService = (userData) => {
    return request.post('/users', userData)
}

export const userUpdateService = (userData) => {
    return request.put('/users', userData)
}

export const userDeleteService = (id) => {
    return request.delete('/users?id=' + id)
}